package com.lantosec.hmrp.modules.sysdata.vo;

import com.lantosec.hmrp.core.mvc.BaseVO;
import com.lantosec.hmrp.modules.sysdata.entity.SysDataForm;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Date;
import java.util.List;

/**
 * <p>
 * 系统数据表单定义表 VO对象
 * </p>
 *
 * @author AutoCode
 * @since 2020-03-02
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(value = "SysDataForm对象", description = "系统数据表单定义表")
public class SysDataFormVO extends BaseVO<SysDataForm> {
    private static final long serialVersionUID = 1L;
    @ApiModelProperty(value = "数据表单ID")
    private String dataFormId;
    @ApiModelProperty(value = "数据表单名称")
    private String dataFormName;
    @ApiModelProperty(value = "对应的数据模型ID")
    private String dataModelId;
    @ApiModelProperty(value = "表单类型(1主表2从表)")
    private Integer dataFormType;
    @ApiModelProperty(value = "表单布局JSON字符串")
    private String dataFormLayout;
    @ApiModelProperty(value = "创建时间")
    private Date createTime;
    @ApiModelProperty(value = "最后编辑时间")
    private Date editTime;
    @ApiModelProperty(value = "父级表单ID")
    private String parentId;
    private List<FieldVO> fields;

    public SysDataFormVO(SysDataForm entity) {
        this.dataFormId = entity.getDataFormId();
        this.dataFormName = entity.getDataFormName();
        this.dataModelId = entity.getDataModelId();
        this.dataFormType = entity.getDataFormType();
        this.dataFormLayout = entity.getDataFormLayout();
        this.createTime = entity.getCreateTime();
        this.editTime = entity.getEditTime();
    }

    @Override
    public SysDataForm convertToEntity() {
        return new SysDataForm(this);
    }
}
